import os
from pathlib import Path

from ok.util.path import get_path_in_package
# from src.task.AutoCombatTask import AutoCombatTask
# from src.task.AutoPickTask import AutoPickTask
# from src.task.DiagnosisTask import DiagnosisTask
# from src.task.FarmEchoTask import FarmEchoTask
# from src.task.FarmWorldBossTask import FarmWorldBossTask
# from src.task.FiveToOneTask import FiveToOneTask
# from src.task.SkipDialogTask import AutoDialogTask
# from src.task.AutoPickTaskYs import AutoPickTaskYs
# from src.task.AutoCombatTaskYs import AutoCombatTaskYs

# version = "v5.0.11"
version = "v0.1.0"


def calculate_pc_exe_path(running_path):
    # game_exe_folder = Path(running_path).parents[3]
    # return str(game_exe_folder / "YuanShen.exe")
    return running_path
config = {
    'debug': False,  # Optional, default: False
    'use_gui': True,
    'config_folder': 'configs',
    'gui_icon': get_path_in_package(__file__, 'icon.png'),
    'ocr': {
        'lib': 'RapidOCR'
    },
    'start_timeout': 120,  # default 60
    # required if using feature detection
    'template_matching': {
        # 'coco_feature_json': os.getcwd() +os.sep+ os.path.join('assets', '_annotations.coco.json'),
        'lableme_feature_json_path':'assets_xt',
        # 'coco_feature_json': [os.path.join('assets', '_annotations.coco.json'),
        #                       os.path.join('assets_ys', 'ys-ok.json')],
        # 'images_path': 'images_ys',
        'default_horizontal_variance': 0.002,
        'default_vertical_variance': 0.002,
        'default_threshold': 0.8,
    },
    'windows': {  # required  when supporting windows game
        # 'exe': 'Client-Win64-Shipping.exe',
        'exe': 'StarRail.exe',
        # 'exe': 'WeChar.exe',
        # 'title': '微信',
        'calculate_pc_exe_path': calculate_pc_exe_path,
        # 'hwnd_class': 'UnrealWindow',
        'hwnd_class': 'UnityWndClass',  # 原神
        # 'hwnd_class': 'WeChatMainWndForPC',  # 微信
        # 'interaction': 'PostMessage',#键盘鼠标模拟后台，部分支持
        'interaction': 'Other',#键盘鼠标模拟前台
        'can_bit_blt': True,  # default false, opengl games does not support bit_blt
        'bit_blt_render_full': True,
        'check_hdr': False,
        'force_no_hdr': False,
        'check_night_light': True,
        'force_no_night_light': True,
        'require_bg': True
    },
    'supported_resolution': {
        'ratio': '16:9',
        'min_size': (1280, 720)
    },
    # 'analytics': {
    #     'report_url': 'http://111.231.71.225/report'
    # },
    # 'update': {
    #     'releases_url': 'https://api.github.com/repos/ok-oldking/ok-wuthering-waves/releases?per_page=15',
    #     'proxy_url': 'http://111.231.71.225/',
    #     'exe_name': 'ok-ww.exe',
    #     'use_proxy': True
    # },
    'about': """
        <h3>ok-xt</h3>
          <p>Gitee <a href="https://gitee.com/andnnl/ok-xt">https://gitee.com/andnnl/ok-xt</></p>
        <p style="color:red;">
        <strong>本软件是免费开源的。</strong> 如果你被收费，请立即退款。请访问Gitee下载最新的官方版本。
        </p>
        <p style="color:red;">
            <strong>本软件仅供个人使用，用于学习Python编程、计算机视觉、UI自动化等。</strong> 请勿将其用于任何营利性或商业用途。
        </p>
        <p style="color:red;">
            <strong>使用本软件可能会导致账号被封。</strong> 请在了解风险后再使用。
        </p>
    """,

    'screenshots_folder': "screenshots",
    'gui_title': 'ok-xt',  # Optional
    # 'coco_feature_folder': get_path(__file__, 'assets/coco_feature'),  # required if using feature detection
    'log_file': 'logs/ok-xt.log',  # Optional, auto rotating every day
    'error_log_file': 'logs/ok-xt_error.log',
    'version': version,
    'onetime_tasks': [  # tasks to execute
        # ["src.task.SwitchUser", "SwitchUser"],
        ["src.task.TestTask", "TestTask"],
    ], 'trigger_tasks': [
        # ["src.task.AutoLoginTaskYs", "AutoLoginTaskYs"],
        # ["src.task.AutoSwitchUser", "AutoSwitchUser"],
        ["src.task.AutoDialogYs", "AutoDialogYs"],
        # ["src.task.AutoPickTaskYs", "AutoPickTaskYs"],
        # ["src.task.AutoMainStorylineYs", "AutoMainStorylineYs"],
        # ["src.task.AutoCombatTaskYs", "AutoCombatTaskYs"],
        # ["src.task.AutoCollectDayYs", "AutoCollectDayYs"],
        # ["src.task.AutoSecretRealmYs", "AutoSecretRealmYs"],
        # ["src.task.AutoButterfly", "AutoButterfly"],
        # ["src.task.AutoSywDecompose", "AutoSywDecompose"],

    ]

}


